<?php
/**
 * Created by PhpStorm.
 * User: jieai
 * Date: 2017-04-04
 * Time: 20:35
 */
namespace Home\Controller;

use Think\Controller;
class MyController extends Controller{
    /**
     * @param string $msg 返回信息,如果status为1默认返回成功
     * @param int $status 1为成功.0为失败
     */
    public function ajr($msg="",$status=1)
    {if ($msg){
        return $this->ajaxReturn(array('msg'=>$msg,'status'=>$status));
    }else{
        $temp=$status==1?'成功':'失败';
        return $this->ajaxReturn(array('msg'=>$temp,'status'=>$status));
    }


    }

    public function MyAutoCloseSuccess($msg)
    {
        $rUrl="javascript:window.top.closeatab()";
        $this->success($msg,$rUrl);
    }

    public function MyAutoCloseError($msg)
    {
        $rUrl="javascript:window.top.closeatab()";
        $this->error($msg,$rUrl);
    }

    public function Checklogin()
    {
        if (!session('islogin')){
            $this->error('你没有权限!');
            return;
        }
    }
}